namespace CSharpPro._1023;

public class Demo

{
    
        // 作业1：冒泡排序实现
        public static void TestPrint(int[] array)
        {
            if (array == null || array.Length <= 1)
                return;

            int n = array.Length;
            for (int i = 0; i < n - 1; i++)
            {
                bool swapped = false;
                for (int j = 0; j < n - i - 1; j++)
                {
                    if (array[j] > array[j + 1])
                    {
                        int temp = array[j];
                        array[j] = array[j + 1];
                        array[j + 1] = temp;
                        swapped = true;
                    }
                }
                if (!swapped)
                    break;
            }
        }

    
        
    }
